package com.yyr.spring_boot.modules.common.vo;

import com.fasterxml.jackson.annotation.JsonFormat;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ImageType {
    PROFILE_BIG("profileBig", 1024, 1000, 1000),
    PROFILE_MIDDLE("profileMiddle", 500, 300, 300),
    PROFILE_SMALL("profileSmall", 100, 20, 20)
    ;
    public String name;
    public int size;
    public int width;
    public int height;

    public static ImageType getImageByName(String name) {
        ImageType[] imageTypes = ImageType.values();
        for (ImageType type : imageTypes) {
            if (name.equals(type.name)) {
                return type;
            }
        }
        return ImageType.PROFILE_SMALL;
    }

    ImageType(String name, int size, int width, int height) {
        this.name = name;
        this.size = size;
        this.width = width;
        this.height = height;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }
}
